package com.crazyhat.crazyhat.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.crazyhat.crazyhat.vaildation.ValidationGroup.InsertValidAtionGroup;
import com.fasterxml.jackson.annotation.JsonFormat;

import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 动态
 * </p>
 *
 * @author crazyhat
 * @since 2024-07-05
 */
@Getter
@Setter
@TableName("post")
public class Post implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 动态ID
     */
    @TableId(value = "post_id", type = IdType.AUTO)
    private Integer postId;

    /**
     * 社团ID
     */
    @NotNull(groups=InsertValidAtionGroup.class)
    @TableField("club_id")
    private Integer clubId;

    /**
     * 学号
     */
    @TableField("student_id")
    private Integer studentId;

    /**
     * 发布时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("publish_time")
    private LocalDateTime publishTime;

    /**
     * 标题
     */
    @NotEmpty
    @TableField("title")
    private String title;

    /**
     * 内容
     */
    @NotEmpty
    @TableField("post_content")
    private String postContent;
}
